package cn.accjiyun.inventory.model;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.sql.Date;

/**
 * Created by jiyun on 2016/7/4.
 */
@Entity
public class Retrieval {
    private String id;
    private String goodsId;
    private Date date;
    private Double outPrice;
    private Integer number;
    private String consignee;
    private String operator;

    @Id
    @Column(name = "id", nullable = false, length = 8)
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "goodsId", nullable = false, length = 8)
    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    @Basic
    @Column(name = "date", nullable = false)
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Basic
    @Column(name = "outPrice", nullable = true, precision = 0)
    public Double getOutPrice() {
        return outPrice;
    }

    public void setOutPrice(Double outPrice) {
        this.outPrice = outPrice;
    }

    @Basic
    @Column(name = "number", nullable = true)
    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    @Basic
    @Column(name = "consignee", nullable = false, length = 20)
    public String getConsignee() {
        return consignee;
    }

    public void setConsignee(String consignee) {
        this.consignee = consignee;
    }

    @Basic
    @Column(name = "operator", nullable = false, length = 20)
    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Retrieval retrieval = (Retrieval) o;

        if (id != null ? !id.equals(retrieval.id) : retrieval.id != null) return false;
        if (goodsId != null ? !goodsId.equals(retrieval.goodsId) : retrieval.goodsId != null) return false;
        if (date != null ? !date.equals(retrieval.date) : retrieval.date != null) return false;
        if (outPrice != null ? !outPrice.equals(retrieval.outPrice) : retrieval.outPrice != null) return false;
        if (number != null ? !number.equals(retrieval.number) : retrieval.number != null) return false;
        if (consignee != null ? !consignee.equals(retrieval.consignee) : retrieval.consignee != null) return false;
        if (operator != null ? !operator.equals(retrieval.operator) : retrieval.operator != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (goodsId != null ? goodsId.hashCode() : 0);
        result = 31 * result + (date != null ? date.hashCode() : 0);
        result = 31 * result + (outPrice != null ? outPrice.hashCode() : 0);
        result = 31 * result + (number != null ? number.hashCode() : 0);
        result = 31 * result + (consignee != null ? consignee.hashCode() : 0);
        result = 31 * result + (operator != null ? operator.hashCode() : 0);
        return result;
    }
}
